//
//  AddFamilyTableViewCell.m
//  WideHelp
//
//  Created by ENERGY on 2018/8/14.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "AddFamilyTableViewCell.h"

@interface AddFamilyTableViewCell()
@property (nonatomic, strong)UIImageView * projectImg;
@property (nonatomic, strong)UILabel * projectTitleLab;
@property (nonatomic, strong)UILabel * projectInstrucrtionLab;
@property (nonatomic, strong)UILabel * ageLab;
@property (nonatomic, strong)UIView * lineView;
@end

@implementation AddFamilyTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor whiteColor];
        __weak typeof (self)weakSelf = self;
        [self.contentView addSubview:self.projectImg];
        [self.contentView addSubview:self.projectTitleLab];
        [self.contentView addSubview:self.projectInstrucrtionLab];
        [self.contentView addSubview:self.ageLab];
        [self.contentView addSubview:self.lineView];
        [self.projectImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(16/WIDTH_6_SCALE);
            make.top.equalTo(weakSelf.contentView.mas_top).mas_offset(17/WIDTH_6_SCALE);
            make.width.mas_offset(137/WIDTH_6_SCALE);
            make.height.mas_offset(121/WIDTH_6_SCALE);
        }];
        [self.projectTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.projectImg.mas_right).mas_offset(20/WIDTH_6_SCALE);
            make.top.equalTo(weakSelf.projectImg.mas_top).mas_offset(7/WIDTH_6_SCALE);
            make.height.mas_offset(14/WIDTH_6_SCALE);
        }];
        [self.projectInstrucrtionLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.projectTitleLab.mas_left);
            make.right.equalTo(weakSelf.contentView.mas_right).mas_offset(-34/WIDTH_6_SCALE);
            make.top.equalTo(weakSelf.projectTitleLab.mas_bottom).mas_offset(11/WIDTH_6_SCALE);
        }];
        [self.ageLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.projectTitleLab);
            make.height.mas_offset(14/WIDTH_6_SCALE);
            make.bottom.equalTo(weakSelf.projectImg.mas_bottom).mas_offset(-3/WIDTH_6_SCALE);
        }];
        [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.left.right.equalTo(weakSelf.contentView);
            make.height.mas_offset(1/WIDTH_6_SCALE);
        }];
    }return self;
}

- (UIImageView *)projectImg{
    if (!_projectImg) {
        _projectImg = [[UIImageView alloc] init];
        _projectImg.backgroundColor = [UIColor redColor];
    }return _projectImg;
}

- (UILabel *)projectTitleLab{
    if (!_projectTitleLab) {
        _projectTitleLab = [[UILabel alloc] init];
        _projectTitleLab.font = DEF_FontSize_13;
        _projectTitleLab.textColor = [UIColor blackColor];
        _projectTitleLab.textAlignment = NSTextAlignmentLeft;
    }return _projectTitleLab;
}
- (UILabel *)projectInstrucrtionLab{
    if (!_projectInstrucrtionLab) {
        _projectInstrucrtionLab = [[UILabel alloc] init];
        _projectInstrucrtionLab.font = DEF_FontSize_12;
        _projectInstrucrtionLab.textColor = [UIColor blackColor];
        _projectInstrucrtionLab.textAlignment = NSTextAlignmentLeft;
        _projectInstrucrtionLab.numberOfLines = 0;
        _projectInstrucrtionLab.lineBreakMode = 0;
    }return _projectInstrucrtionLab;
}
-  (UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = getColor(@"eeeeee");
    }return _lineView;
}
- (UILabel *)ageLab{
    if (!_ageLab) {
        _ageLab = [[UILabel alloc] init];
        _ageLab.font = DEF_FontSize_13;
        _ageLab.textColor = getColor(greenBGColor);
        _ageLab.textAlignment = NSTextAlignmentLeft;
    }return _ageLab;
}
- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.projectTitleLab.text = model[@"title"];
    self.projectInstrucrtionLab.text = model[@"content"];
    self.ageLab.text = model[@"age"];
}
@end
